package ch03.shangJi.sj1.factory;

import ch03.shangJi.sj1.dao.*;

public class ArithmeticFactory {
    public static ArithmeticDao getInstance(String operator){
        switch (operator){
            case "+":
                return new AddDaoImpl();
            case "-":
                return new SubtractionDaoImpl();
            case "*":
                return new MultiplyDaoImpl();
            case "/":
                return new DivideDaoImpl();
            default:
                throw new RuntimeException("此运算符无效");
        }
    }
}
